<?php

##################################################
#
# Copyright (c) 2004-2013 OIC Group, Inc.
#
# This file is part of Exponent
#
# Exponent is free software; you can redistribute
# it and/or modify it under the terms of the GNU
# General Public License as published by the Free
# Software Foundation; either version 2 of the
# License, or (at your option) any later version.
#
# GPL: http://www.gnu.org/licenses/gpl.txt
#
##################################################

/**
 * @subpackage Models
 * @package Modules
 */

class urlclick extends expRecord {

    protected $attachable_item_types = array(
        'content_expFiles'=>'expFile',
        'content_expCats'=>'expCat'
    );

    public $validates = array(
        'presence_of'=>array(
            'title'=>array('message'=>'Title is a required field.'),
            'url'=>array('message'=>"you didn't provide a link...  Do so now."),
        )
    );
    public function makelink($id)
    {
        global $db,$user;
        $id=intval($id);
        $data=$db->selectObject('urlclick_list',"id={$id}");
        
        $encode=json_encode( array('id'=>$data->id,
         'salt'=>$data->salt,
         'uid'=> $user->id
         )); 
        $_time=time();
        $_key= md5($_time);
        expSession::set('stime',$_time);
        return expCore::sencode($encode,$_key); 
    }
                    
   
}

?>